﻿var counter =0;
$(function(){
//Defultly hide all the textboxes and DrobdownList
 	$("#appointmentTxtBx1").hide();
 	$("#appointmentTxtBx2").hide();
 	$("#appointmentTxtBx3").hide();
 	$("#appointmentTxtBx4").hide();
 	$("#dateTxtBx1").hide();
 	$("#dateTxtBx2").hide();
 	$("#dateTxtBx3").hide();
 	$("#dateTxtBx4").hide();
 	$("#advisorNameTxtBx1").hide();
 	$("#advisorNameTxtBx2").hide();
 	$("#advisorNameTxtBx3").hide();
 	$("#advisorNameTxtBx4").hide();
 	$("#statusList1").hide();
 	$("#statusList2").hide();
 	$("#statusList3").hide();
 	$("#statusList4").hide();

	

 	$(".viewButton").click(function(){
 	var viewId = this.name;
 	viewAppointment(viewId);
 	})
 	
 	$(".editButton").click(function(){
 	var updateId = this.name;
 	updateAppointment(updateId );
 	})
	
	//$(".deleteButton").click(function(){
 	//var deleteId = this.name;
 	//deleteAppointment(deleteId);
 	//})
 
})

function viewAppointment(name){
alert('View button Clicked. ID = ' + name);

//Comment out bellow line to navigate to . Currently disabled.
//window.location.href = "https://www.google.com"
}

function updateAppointment(name){
	//alert('Update button Clicked. ID = ' + name);
			
	switch(name){
		case 'edit':$("#appiontmentID1").hide();
					$("#appointmentTxtBx1").show();
					$("#date1").hide();
					$("#dateTxtBx1").show();
					$("#advisorName1").hide();
					$("#advisorNameTxtBx1").show();
					$("#status1").hide();
					$("#statusList1").show();					
					$("#edit1").prop('value', 'Update');
			break;
		
		case 'edit0':$("#appiontmentID2").hide();
					$("#appointmentTxtBx2").show();
					$("#date2").hide();
					$("#dateTxtBx2").show();
					$("#advisorName2").hide();
					$("#advisorNameTxtBx2").show();
					$("#status2").hide();
					$("#statusList2").show();
					$("#edit2").prop('value', 'Update');
					break;
		
		case 'edit1':$("#appiontmentID3").hide();
					$("#appointmentTxtBx3").show();
					$("#date3").hide();
					$("#dateTxtBx3").show();
					$("#advisorName3").hide();
					$("#advisorNameTxtBx3").show();
					$("#status3").hide();
					$("#statusList3").show();
					$("#edit3").prop('value', 'Update');
					break;
		case 'edit2':$("#appiontmentID4").hide();
					$("#appointmentTxtBx4").show();
					$("#date4").hide();
					$("#dateTxtBx4").show();
					$("#advisorName4").hide();
					$("#advisorNameTxtBx4").show();
					$("#status4").hide();
					$("#statusList4").show();
					$("#edit4").prop('value', 'Update');
					break;	
}
}

function updateButtonHandler(buttonID){
var lastButton;
var btnPressed;

if(lastButton != buttonID){
}
}

function deleteAppointment(name){
	//alert('Delete button Clicked = ' + name);
}